{% extends 'pet_admin/base.html'%}

{% block main_body %}
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      订单管理
      <small>幻兽商城后台</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href="{% url 'admin_index' %}"><i class="fa fa-dashboard"></i> 首页</a></li>
      <li class="active">订单管理</li>
    </ol>
  </section>

  <!-- Main content -->
  <section class="content container-fluid">

    <div class="row">
      <div class="col-xs-12">
        <div class="box">
          <div class="box-header">
            <h3 class="box-title">订单列表</h3>
            <div class="box-tools">

              <form action="{% url 'admin_find_order' 1 %}" method="get">

                <div class="input-group input-group-sm" style="width: 150px;">
                  <input type="text" name="user_name" class="form-control pull-right" placeholder="下单人" >
                  <div class="input-group-btn">
                    <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                  </div>
                </div>
              </form>
            </div>

          </div>
          <!-- /.box-header -->
          <div class="box-body table-responsive no-padding">
            <table class="table table-hover">
              <tr>
                <th>订单编号</th>
                <th>订单数量</th>
                <th>金额</th>
                <th>下单人</th>
                <th>下单时间</th>
                <th>备注</th>
                <th>操作</th>
              </tr>
              {% for order in orders %}
              <tr>
                  <td>{{ order.order_id }}</td>
                  <td>{{ order.order_num }}</td>
                  <td>{{ order.order_money }}</td>
                  <td>{{ order.user_name }}</td>
                  <td>{{ order.order_createtime|date:'Y-m-d' }}</td>
                  <td>
                    {% if order.order_remark == None %}

                    {% else %}
                    {{ order.order_remark }}
                    {% endif %}
                  </td>
                <td>
                  <button type="button" onclick="doDel('{% url 'admin_del_order' order.order_id %}')" class="btn btn-danger btn-xs">
                    <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除</button>
                  <a type="button" class="btn btn-warning btn-xs" href="{% url 'admin_find_orderSub' 1%}?order_id={{ order.order_id }}">
                    <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 查看明细</a>
                </td>
              </tr>
              {% endfor %}
            </table>

          </div>
          <!-- /.box-body -->
          <div class="box-footer clearfix">
<!--            <a role="button" href="#" class="btn btn-primary">-->
<!--                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 添加类型</a>-->
            <ul class="pagination pagination-sm no-margin pull-right">
              <li><a href="{% if pageIndex != 1 %}{% url 'admin_find_order' pageIndex|add:-1 %}?{{ searchKey|join:'&' }} {% endif %}">&laquo;</a></li>
                {% for page in pages %}
                  <li {% if page == pageIndex %} class = "active" {% endif %}><a href="{% url 'admin_find_order' page %}?{{ searchKey|join:'&' }}">{{ page }}</a></li>
                {% endfor %}
              <li><a href="{% if pageIndex != maxPage %}{% url 'admin_find_order' pageIndex|add:1 %}?{{ searchKey|join:'&' }} {% endif %}">&raquo;</a></li>
            </ul>
          </div>
        </div>
        <!-- /.box -->
      </div>
    </div>

  </section>
  <!-- /.content -->
{% endblock %}